package com.icangya.DAO.impl;

import com.icangya.DAO.IFbUsermoodDAO;
import com.icangya.Utils.SQLUtilt;
import com.icangya.domain.FbUsermood;
import org.springframework.stereotype.Repository;

import java.util.List;

import static com.icangya.Value.StaticValue.PHONE_PAGE_ROW;

@Repository
public class FbUsermoodDAOImpl  extends BaseDAO<FbUsermood> implements IFbUsermoodDAO {


    @Override
    public List selectUsermoods(String openId,int startPage) {

        String hql="FROM FbUsermood fb where fb.userOpenid=? order by  fb.createTime desc";
        String count = "SELECT COUNT(fb) FROM FbUsermood fb where fb.userOpenid='"+openId+"' " ;
        Long total = (Long) getHibernateTemplate().find(count).get(0);
        return  SQLUtilt.getIstance().doPage(getHibernateTemplate(), hql, total, startPage, 8,openId);
//        List<FbUsermood> list=(List<FbUsermood>) getHibernateTemplate().find(hql,openId);
//        return list;
    }
}
